package com.example.basicknowledge.GridView;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.ArrayAdapter;
import android.widget.GridView;

import com.example.basicknowledge.R;

import java.util.ArrayList;

public class GridViewActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.grid_view_activity);
        ArrayList words = new ArrayList();
        words.add("aa");
        words.add("bb");
        words.add("cc");
        words.add("dd");
        ArrayAdapter<String> itemsAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,words);
        GridView view = (GridView)findViewById(R.id.gridView);
        view.setAdapter(itemsAdapter);

    }
}

